package com.ouc.eddyAlgorithm.controller;

import com.ouc.common.annotation.Log;
import com.ouc.common.core.controller.BaseController;
import com.ouc.common.core.domain.AjaxResult;
import com.ouc.common.core.page.TableDataInfo;
import com.ouc.common.enums.BusinessType;
import com.ouc.common.utils.poi.ExcelUtil;
import com.ouc.eddyAlgorithm.domain.VgAfterTrack;
import com.ouc.eddyAlgorithm.service.IVgAfterTrackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 涡旋跟踪后表Controller
 * 
 * @author yh
 * @date 2025-02-06
 */
@RestController
@RequestMapping("/eddyAlgorithm/vgA3b4Aftertrack")
public class VgAfterTrackController extends BaseController
{
    @Autowired
    private IVgAfterTrackService vgAfterTrackService;

    /**
     * 查询涡旋跟踪后表列表
     */
    @PreAuthorize("@ss.hasPermi('eddyAlgorithm:vgA3b4Aftertrack:list')")
    @GetMapping("/list")
    public TableDataInfo list(VgAfterTrack vgAfterTrack)
    {
        startPage();
        List<VgAfterTrack> list = vgAfterTrackService.selectVgAfterTrackList(vgAfterTrack);
        return getDataTable(list);
    }

    /**
     * 导出涡旋跟踪后表列表
     */
    @PreAuthorize("@ss.hasPermi('eddyAlgorithm:vgA3b4Aftertrack:export')")
    @Log(title = "涡旋跟踪后表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VgAfterTrack vgAfterTrack)
    {
        List<VgAfterTrack> list = vgAfterTrackService.selectVgAfterTrackList(vgAfterTrack);
        ExcelUtil<VgAfterTrack> util = new ExcelUtil<VgAfterTrack>(VgAfterTrack.class);
        util.exportExcel(response, list, "涡旋跟踪后表数据");
    }

    /**
     * 获取涡旋跟踪后表详细信息
     */
    @PreAuthorize("@ss.hasPermi('eddyAlgorithm:vgA3b4Aftertrack:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(vgAfterTrackService.selectVgAfterTrackById(id));
    }

    /**
     * 新增涡旋跟踪后表
     */
    @PreAuthorize("@ss.hasPermi('eddyAlgorithm:vgA3b4Aftertrack:add')")
    @Log(title = "涡旋跟踪后表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VgAfterTrack vgAfterTrack)
    {
        return toAjax(vgAfterTrackService.insertVgAfterTrack(vgAfterTrack));
    }

    /**
     * 修改涡旋跟踪后表
     */
    @PreAuthorize("@ss.hasPermi('eddyAlgorithm:vgA3b4Aftertrack:edit')")
    @Log(title = "涡旋跟踪后表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VgAfterTrack vgAfterTrack)
    {
        return toAjax(vgAfterTrackService.updateVgAfterTrack(vgAfterTrack));
    }

    /**
     * 删除涡旋跟踪后表
     */
    @PreAuthorize("@ss.hasPermi('eddyAlgorithm:vgA3b4Aftertrack:remove')")
    @Log(title = "涡旋跟踪后表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(vgAfterTrackService.deleteVgAfterTrackByIds(ids));
    }
}
